package top.huhuiyu.ds;

/**
 * 
 * @author Aiden Pearce
 *
 */
public class Monkey {
  public static int go(int num) {
    System.out.print(num + " ");
    int count = 0;
    if (num == 1) {
      return count + 1;
    }
    count = count + 1;
    if (num % 2 == 0) {
      count = count + go(num / 2);
    } else {
      count = count + go(num * 3 + 1);
    }
    return count;
  }

  public static int forgo(int num) {
    int count = 0;
    if (num != 1 || num != 0) {
      if (num % 2 == 0) {
        count = count + forgo(num / 2);
      } else {
        count = count + forgo(num * 3 + 1);
      }
    }
    return count;
  }

  public static void main(String[] args) {
    // System.out.println(go(22));
    System.out.println(forgo(22));
  }
}
